package com.huawei.pojo;

public class ListNodeT1 {
    private int num;
    private ListNodeT1 next;
    public ListNodeT1(int num, ListNodeT1 next) {
        this.num = num;
        this.next = next;
    }
    public int getNum() {
        return num;
    }
    public void setNum(int num) {
        this.num = num;
    }
    public ListNodeT1 getNext() {
        return next;
    }
    public void setNext(ListNodeT1 next) {
        this.next = next;
    }
    public static ListNodeT1 loop(int n){
        ListNodeT1 first = new ListNodeT1(1, null);
        ListNodeT1 index = first;
        for (int i = 2; i <= n; i++) {
            ListNodeT1 next = new ListNodeT1(i, null);
            index.setNext(next);
            index = next;
        }
        index.setNext(first);
        return first;
    }
}
